<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>window.cpp 示例文件 | Qt Widgets 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-widgets-lineedits-example.html">Line Edits Example</a></td><td >window.cpp 示例文件</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">window.cpp 示例文件</h1>
<span class="subtitle">widgets/lineedits/window.cpp</span>
<!-- $$$widgets/lineedits/window.cpp-description -->
<div class="descr"> <a name="details"></a>
<pre class="cpp">

  <span class="comment">/****************************************************************************
  **
  ** Copyright (C) 2016 The Qt Company Ltd.
  ** Contact: https://www.qt.io/licensing/
  **
  ** This file is part of the examples of the Qt Toolkit.
  **
  ** $QT_BEGIN_LICENSE:BSD$
  ** Commercial License Usage
  ** Licensees holding valid commercial Qt licenses may use this file in
  ** accordance with the commercial license agreement provided with the
  ** Software or, alternatively, in accordance with the terms contained in
  ** a written agreement between you and The Qt Company. For licensing terms
  ** and conditions see https://www.qt.io/terms-conditions. For further
  ** information use the contact form at https://www.qt.io/contact-us.
  **
  ** BSD License Usage
  ** Alternatively, you may use this file under the terms of the BSD license
  ** as follows:
  **
  ** &quot;Redistribution and use in source and binary forms, with or without
  ** modification, are permitted provided that the following conditions are
  ** met:
  **   * Redistributions of source code must retain the above copyright
  **     notice, this list of conditions and the following disclaimer.
  **   * Redistributions in binary form must reproduce the above copyright
  **     notice, this list of conditions and the following disclaimer in
  **     the documentation and/or other materials provided with the
  **     distribution.
  **   * Neither the name of The Qt Company Ltd nor the names of its
  **     contributors may be used to endorse or promote products derived
  **     from this software without specific prior written permission.
  **
  **
  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  **
  ** $QT_END_LICENSE$
  **
  ****************************************************************************/</span>

  <span class="preprocessor">#include &lt;QtWidgets&gt;</span>

  <span class="preprocessor">#include &quot;window.h&quot;</span>

  Window<span class="operator">::</span>Window()
  {
      <span class="type"><a href="qgroupbox.html">QGroupBox</a></span> <span class="operator">*</span>echoGroup <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgroupbox.html">QGroupBox</a></span>(tr(<span class="string">&quot;Echo&quot;</span>));

      <span class="type"><a href="qlabel.html">QLabel</a></span> <span class="operator">*</span>echoLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;Mode:&quot;</span>));
      <span class="type"><a href="qcombobox.html">QComboBox</a></span> <span class="operator">*</span>echoComboBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcombobox.html">QComboBox</a></span>;
      echoComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Normal&quot;</span>));
      echoComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Password&quot;</span>));
      echoComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;PasswordEchoOnEdit&quot;</span>));
      echoComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;No Echo&quot;</span>));

      echoLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      echoLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setPlaceholderText(<span class="string">&quot;Placeholder Text&quot;</span>);
      echoLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setFocus();

      <span class="type"><a href="qgroupbox.html">QGroupBox</a></span> <span class="operator">*</span>validatorGroup <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgroupbox.html">QGroupBox</a></span>(tr(<span class="string">&quot;Validator&quot;</span>));

      <span class="type"><a href="qlabel.html">QLabel</a></span> <span class="operator">*</span>validatorLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;Type:&quot;</span>));
      <span class="type"><a href="qcombobox.html">QComboBox</a></span> <span class="operator">*</span>validatorComboBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcombobox.html">QComboBox</a></span>;
      validatorComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;No validator&quot;</span>));
      validatorComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Integer validator&quot;</span>));
      validatorComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Double validator&quot;</span>));

      validatorLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      validatorLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setPlaceholderText(<span class="string">&quot;Placeholder Text&quot;</span>);

      <span class="type"><a href="qgroupbox.html">QGroupBox</a></span> <span class="operator">*</span>alignmentGroup <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgroupbox.html">QGroupBox</a></span>(tr(<span class="string">&quot;Alignment&quot;</span>));

      <span class="type"><a href="qlabel.html">QLabel</a></span> <span class="operator">*</span>alignmentLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;Type:&quot;</span>));
      <span class="type"><a href="qcombobox.html">QComboBox</a></span> <span class="operator">*</span>alignmentComboBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcombobox.html">QComboBox</a></span>;
      alignmentComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Left&quot;</span>));
      alignmentComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Centered&quot;</span>));
      alignmentComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Right&quot;</span>));

      alignmentLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      alignmentLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setPlaceholderText(<span class="string">&quot;Placeholder Text&quot;</span>);

      <span class="type"><a href="qgroupbox.html">QGroupBox</a></span> <span class="operator">*</span>inputMaskGroup <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgroupbox.html">QGroupBox</a></span>(tr(<span class="string">&quot;Input mask&quot;</span>));

      <span class="type"><a href="qlabel.html">QLabel</a></span> <span class="operator">*</span>inputMaskLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;Type:&quot;</span>));
      <span class="type"><a href="qcombobox.html">QComboBox</a></span> <span class="operator">*</span>inputMaskComboBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcombobox.html">QComboBox</a></span>;
      inputMaskComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;No mask&quot;</span>));
      inputMaskComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;Phone number&quot;</span>));
      inputMaskComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;ISO date&quot;</span>));
      inputMaskComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;License key&quot;</span>));

      inputMaskLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      inputMaskLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setPlaceholderText(<span class="string">&quot;Placeholder Text&quot;</span>);

      <span class="type"><a href="qgroupbox.html">QGroupBox</a></span> <span class="operator">*</span>accessGroup <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgroupbox.html">QGroupBox</a></span>(tr(<span class="string">&quot;Access&quot;</span>));

      <span class="type"><a href="qlabel.html">QLabel</a></span> <span class="operator">*</span>accessLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;Read-only:&quot;</span>));
      <span class="type"><a href="qcombobox.html">QComboBox</a></span> <span class="operator">*</span>accessComboBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcombobox.html">QComboBox</a></span>;
      accessComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;False&quot;</span>));
      accessComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">&quot;True&quot;</span>));

      accessLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      accessLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setPlaceholderText(<span class="string">&quot;Placeholder Text&quot;</span>);

      connect(echoComboBox<span class="operator">,</span> SIGNAL(activated(<span class="type">int</span>))<span class="operator">,</span>
              <span class="keyword">this</span><span class="operator">,</span> SLOT(echoChanged(<span class="type">int</span>)));
      connect(validatorComboBox<span class="operator">,</span> SIGNAL(activated(<span class="type">int</span>))<span class="operator">,</span>
              <span class="keyword">this</span><span class="operator">,</span> SLOT(validatorChanged(<span class="type">int</span>)));
      connect(alignmentComboBox<span class="operator">,</span> SIGNAL(activated(<span class="type">int</span>))<span class="operator">,</span>
              <span class="keyword">this</span><span class="operator">,</span> SLOT(alignmentChanged(<span class="type">int</span>)));
      connect(inputMaskComboBox<span class="operator">,</span> SIGNAL(activated(<span class="type">int</span>))<span class="operator">,</span>
              <span class="keyword">this</span><span class="operator">,</span> SLOT(inputMaskChanged(<span class="type">int</span>)));
      connect(accessComboBox<span class="operator">,</span> SIGNAL(activated(<span class="type">int</span>))<span class="operator">,</span>
              <span class="keyword">this</span><span class="operator">,</span> SLOT(accessChanged(<span class="type">int</span>)));

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>echoLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      echoLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(echoLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      echoLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(echoComboBox<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      echoLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(echoLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
      echoGroup<span class="operator">-</span><span class="operator">&gt;</span>setLayout(echoLayout);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>validatorLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      validatorLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(validatorLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      validatorLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(validatorComboBox<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      validatorLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(validatorLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
      validatorGroup<span class="operator">-</span><span class="operator">&gt;</span>setLayout(validatorLayout);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>alignmentLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      alignmentLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(alignmentLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      alignmentLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(alignmentComboBox<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      alignmentLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(alignmentLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
      alignmentGroup<span class="operator">-</span><span class="operator">&gt;</span> setLayout(alignmentLayout);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>inputMaskLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      inputMaskLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(inputMaskLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      inputMaskLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(inputMaskComboBox<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      inputMaskLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(inputMaskLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
      inputMaskGroup<span class="operator">-</span><span class="operator">&gt;</span>setLayout(inputMaskLayout);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>accessLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      accessLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(accessLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      accessLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(accessComboBox<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      accessLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(accessLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
      accessGroup<span class="operator">-</span><span class="operator">&gt;</span>setLayout(accessLayout);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(echoGroup<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(validatorGroup<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(alignmentGroup<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(inputMaskGroup<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(accessGroup<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">1</span>);
      setLayout(layout);

      setWindowTitle(tr(<span class="string">&quot;Line Edits&quot;</span>));
  }

  <span class="type">void</span> Window<span class="operator">::</span>echoChanged(<span class="type">int</span> index)
  {
      <span class="keyword">switch</span> (index) {
      <span class="keyword">case</span> <span class="number">0</span>:
          echoLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setEchoMode(<span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">::</span>Normal);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">1</span>:
          echoLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setEchoMode(<span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">::</span>Password);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">2</span>:
          echoLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setEchoMode(<span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">::</span>PasswordEchoOnEdit);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">3</span>:
          echoLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setEchoMode(<span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">::</span>NoEcho);
      }
  }

  <span class="type">void</span> Window<span class="operator">::</span>validatorChanged(<span class="type">int</span> index)
  {
      <span class="keyword">switch</span> (index) {
      <span class="keyword">case</span> <span class="number">0</span>:
          validatorLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setValidator(<span class="number">0</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">1</span>:
          validatorLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setValidator(<span class="keyword">new</span> <span class="type"><a href="../qtgui/qintvalidator.html">QIntValidator</a></span>(
              validatorLineEdit));
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">2</span>:
          validatorLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setValidator(<span class="keyword">new</span> <span class="type"><a href="../qtgui/qdoublevalidator.html">QDoubleValidator</a></span>(<span class="operator">-</span><span class="number">999.0</span><span class="operator">,</span>
              <span class="number">999.0</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> validatorLineEdit));
      }

      validatorLineEdit<span class="operator">-</span><span class="operator">&gt;</span>clear();
  }

  <span class="type">void</span> Window<span class="operator">::</span>alignmentChanged(<span class="type">int</span> index)
  {
      <span class="keyword">switch</span> (index) {
      <span class="keyword">case</span> <span class="number">0</span>:
          alignmentLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setAlignment(<span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>AlignLeft);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">1</span>:
          alignmentLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setAlignment(<span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>AlignCenter);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">2</span>:
          alignmentLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setAlignment(<span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>AlignRight);
      }
  }

  <span class="type">void</span> Window<span class="operator">::</span>inputMaskChanged(<span class="type">int</span> index)
  {
      <span class="keyword">switch</span> (index) {
      <span class="keyword">case</span> <span class="number">0</span>:
          inputMaskLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setInputMask(<span class="string">&quot;&quot;</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">1</span>:
          inputMaskLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setInputMask(<span class="string">&quot;+99 99 99 99 99;_&quot;</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">2</span>:
          inputMaskLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setInputMask(<span class="string">&quot;0000-00-00&quot;</span>);
          inputMaskLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="string">&quot;00000000&quot;</span>);
          inputMaskLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setCursorPosition(<span class="number">0</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">3</span>:
          inputMaskLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setInputMask(<span class="string">&quot;&gt;AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#&quot;</span>);
      }
  }

  <span class="type">void</span> Window<span class="operator">::</span>accessChanged(<span class="type">int</span> index)
  {
      <span class="keyword">switch</span> (index) {
      <span class="keyword">case</span> <span class="number">0</span>:
          accessLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setReadOnly(<span class="keyword">false</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> <span class="number">1</span>:
          accessLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setReadOnly(<span class="keyword">true</span>);
      }
  }

</pre>
</div>
<!-- @@@widgets/lineedits/window.cpp -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
